package util;

import java.io.UnsupportedEncodingException;

public class URLCodeUtil {
    //UrlEncode转码
    public static String encode(String lastURL) {
        try {
            return java.net.URLEncoder.encode(lastURL, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            return null;
        }
    }

    //UrlEncode解码
    public static String decode(String lastURL) {
        try {
            return java.net.URLDecoder.decode(lastURL, "utf-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            return null;
        }
    }

}
